<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h3>x轴的距离:<span class="x">0</span></h3>
    <h3>y轴的距离:<span class="y">0</span></h3>
    <script>
        // 鼠标移动  mousemove

        // 在什么范围内发生结果 事件源  document
        // 事件对象  e  e.clientX  e.clientY
        var xBox = document.querySelector('.x');
        var yBox = document.querySelector('.y');

        document.onmousemove = function(e){
            var x = e.clientX;
            var y = e.clientY;
            xBox.innerText = x;
            yBox.innerText = y;
        }


    </script>
</body>
</html>